<?php 
function kirki_homepage()
{

    
    Kirki::add_field( 'ifan_theme_config', array(
    'priority'    => 40,
    'title'       => esc_html__( '主页', 'ifan_theme' ),
    'panel'       => 'options',
) );

Kirki::add_field( 'home_banner', [
    'type'        => 'repeater',
    'label'       => esc_html__( '轮播图', 'ifan_theme' ),
    'section'     => 'homepage',
    'priority'    => 10,
    'row_label' => [
        'type'  => 'text',
        'value' => esc_html__( 'banner设置', 'ifan_theme' ),
    ],
    'button_label' => esc_html__('添加一张', 'ifan_theme' ),
    'settings'     => 'banner_repeater_setting',
    'default'      => [
        [
            'banner_img' => get_template_directory_uri().'/style/images/woman-5692896_1920.jpg',
            'banner_title'  => function() {
                return bloginfo('name');
            },
            'banner_des'  => function() {
                return bloginfo('name');
            },
            'banner_linktext'  => function() {
                return bloginfo('name');
            },
            'banner_linkurl'  => function() {
                return bloginfo('name');
            },


        ]
    ],
    'fields' => [
        'banner_img' => [
            'type'        => 'image',
            'label'       => esc_html__( '轮播图', 'ifan_theme' ),
            'description' => esc_html__( '如果是背景轮播图,尽量选择暗色', 'ifan_theme' ),
            'default'     => get_template_directory_uri().'/style/images/woman-5692896_1920.jpg',
        ],
        'banner_title' => [
            'type'        => 'text',
            'label'       => esc_html__( '大标题', 'ifan_theme' ),
            'default'     => function() {
                return bloginfo('name');
            },
        ],
        'banner_des' => [
            'type'        => 'text',
            'label'       => esc_html__( '标题描述', 'ifan_theme' ),
            'default'     => function() {
                return bloginfo('name');
            },
        ],
        'banner_linktext' => [
            'type'        => 'text',
            'label'       => esc_html__( '链接文本', 'ifan_theme' ),

            'default'     => function() {
                return bloginfo('name');
            },
        ],
        'banner_linkurl'  => [
            'type'        => 'text',
            'label'       => esc_html__( '链接地址', 'ifan_theme' ),

            'default'     => function() {
                return bloginfo('home');
            },
        ],
    ]
] );
}

 ?>